[DEFAULT]
debug = {{ watcher_logging_debug }}

log_dir = /var/log/kolla/watcher

transport_url = {{ rpc_transport_url }}

{% if service_name == 'watcher-api' %}
[api]
host = {{ api_interface_address }}
port = {{ watcher_api_port }}
workers = {{ watcher_api_workers }}
{% endif %}

[database]
connection = mysql+pymysql://{{ watcher_database_user }}:{{ watcher_database_password }}@{{ watcher_database_address }}/{{ watcher_database_name }}
connection_recycle_time = {{ database_connection_recycle_time }}
max_pool_size = {{ database_max_pool_size }}
max_retries = -1

[keystone_authtoken]
service_type = infra-optim
www_authenticate_uri = {{ keystone_public_url }}
auth_url = {{ keystone_internal_url }}
auth_type = password
project_domain_id = {{ default_project_domain_id }}
user_domain_id = {{ default_user_domain_id }}
project_name = service
username = {{ watcher_keystone_user }}
password = {{ watcher_keystone_password }}
service_token_roles_required = true
cafile = {{ openstack_cacert }}
region_name = {{ openstack_region_name }}

memcache_security_strategy = {{ memcache_security_strategy }}
memcache_secret_key = {{ memcache_secret_key }}
memcached_servers = {% for host in groups['memcached'] %}{{ 'api' | kolla_address(host) | put_address_in_context('memcache') }}:{{ memcached_port }}{% if not loop.last %},{% endif %}{% endfor %}

[watcher_clients_auth]
auth_uri = {{ keystone_internal_url }}
auth_url = {{ keystone_internal_url }}
auth_type = password
project_domain_id = {{ default_project_domain_id }}
user_domain_id = {{ default_user_domain_id }}
project_name = service
username = {{ watcher_keystone_user }}
password = {{ watcher_keystone_password }}
cafile = {{ openstack_cacert }}

[oslo_concurrency]
lock_path = /var/lib/watcher/tmp

[oslo_messaging_notifications]
transport_url = {{ notify_transport_url }}
{% if watcher_enabled_notification_topics %}
driver = messagingv2
topics = {{ watcher_enabled_notification_topics | map(attribute='name') | join(',') }}
{% else %}
driver = noop
{% endif %}

[oslo_messaging_rabbit]
use_queue_manager = true
heartbeat_in_pthread = false
{% if om_enable_rabbitmq_tls | bool %}
ssl = true
ssl_ca_file = {{ om_rabbitmq_cacert }}
{% endif %}
rabbit_quorum_queue = true
{% if om_enable_rabbitmq_stream_fanout | bool %}
rabbit_stream_fanout = true
rabbit_qos_prefetch_count = {{ om_rabbitmq_qos_prefetch_count }}
{% endif %}
rabbit_transient_quorum_queue = true

{% if watcher_policy_file is defined %}
[oslo_policy]
policy_file = {{ watcher_policy_file }}
{% endif %}
